from frontend.roleApplication import RoleApplication
from frontend.form import Type

class PaymentApplication (RoleApplication):
    def __init__(self):
        '''
        Declare this application to be part of a given work flow and specify its role in that workflow.
        '''
        # Declare this application to be part of a given workflow, and responsible for a given role:
        # !!! Modify the following to use the actual work flow name and role name you need...
        super(PaymentApplication, self).__init__("CantonCandy", "Cashier") 
        
        # Declare any tasks that this role is able to perform:
        # !!! Modify to use actual task name and name_fields:
        self.register_sink_step("ProcessPayment", self.prepare_candy_form_creator, name_fields=["sequence", "CandyType", "CandyQuantity"])

    def prepare_candy_form_creator(self, stepname, form):
        '''
        Defines the data entry form for the barista application.
        This form appears once the barista selects one of the pending orders from a list.
        '''
        # !!! Use one or more fields from order to define label...
        form.add_task_label(fields=["CandyType","CandyQuantity"]) 
        # !!! Add any static labels or fields you want to include in this form...

if __name__ == '__main__':
    #starts up the BaristaApplication:
    app = PaymentApplication()
    #Start interacting with the user:
    app.MainLoop()    
